package analyzemytime.reports;

import java.util.HashMap;
import java.util.Iterator;

import analyzemytime.datamodel.Employee;
import analyzemytime.datamodel.Project;

public class MonthlyOverallReport {
	
	HashMap<Employee, HashMap<Project,Double>> employeeMap = new HashMap<Employee, HashMap<Project,Double>>();
	HashMap<Project, HashMap<Employee,Double>> projectMap = new HashMap<Project, HashMap<Employee,Double>>();
	private String month;
	private String year;
	
	public String getMonth() {
		return month;
	}

	public void setMonth(String month) {
		this.month = month;
	}

	public String getYear() {
		return year;
	}

	public void setYear(String year) {
		this.year = year;
	}

	public MonthlyOverallReport(HashMap<Employee,HashMap<Project, Double>> map,String month, String year){
		this.employeeMap = map;
		this.month = month;
		this.year = year;
	}
	
	public MonthlyOverallReport(HashMap<Project , HashMap<Employee, Double>> map,String month, String year,String obsolete){
		this.projectMap=map; 
		this.month = month;
		this.year = year;
	}
	
	public void printMaps(String option){
		if(option.equals("employee")){
			Iterator<Employee> iterator = employeeMap.keySet().iterator();
			while(iterator.hasNext()){
				Employee employee = iterator.next();
				System.out.println("Employee: "+employee.toString()+" Month: "+this.getMonth()+" Year: "+this.getYear());
				System.out.println("Project | hours");
				Iterator<Project> iterator2 = employeeMap.get(employee).keySet().iterator();
				while(iterator2.hasNext()){
					Project project = iterator2.next();
					System.out.println(project.toString()+"    "+employeeMap.get(employee).get(project));
				}
			}		
		}else if(option.equals("project")){
			Iterator<Project> iterator = projectMap.keySet().iterator();
			while(iterator.hasNext()){
				Project project = iterator.next();
				System.out.println("Project: "+project.toString()+" Month: "+this.getMonth()+" Year: "+this.getYear());
				System.out.println("Employee | hours");
				Iterator<Employee> iterator2 = projectMap.get(project).keySet().iterator();
				while(iterator2.hasNext()){
					Employee employee = iterator2.next();
					System.out.println(employee.toString()+"    "+projectMap.get(project).get(employee));
				}
			}		
		}
	}
	
}
